package com.chookss.home.adapter

import com.bumptech.glide.Glide
import com.johnrambo.ktea.base.LiteAdapter
import com.johnrambo.ktea.common.cropCenter
import com.chookss.R
import com.chookss.home.entity.TestEntiry
import kotlinx.android.synthetic.main.item_list_data.view.*

class ListTestAdapter : LiteAdapter<TestEntiry>(R.layout.item_list_data) {
    override fun onBindViewHolder(holder: VH, position: Int) {
        val entity = datas[position]
        holder.itemView.run {
            /*Glide.with(context).load(entity.coverImg).cropCenter().into(ivUrl)
            tvName.text = entity.movieName
            tvTitle.text = entity.videoTitle
            tvType.text = entity.type[0]*/
            when (position) {
                0 -> Glide.with(context)
                    .load("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1929674343,2497714965&fm=26&gp=0.jpg")
                    .cropCenter().into(ivUrl)
                1 -> Glide.with(context)
                    .load("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3723467577,2632689969&fm=26&gp=0.jpg")
                    .cropCenter().into(ivUrl)
                2 -> Glide.with(context)
                    .load("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=229007078,3607512502&fm=26&gp=0.jpg")
                    .cropCenter().into(ivUrl)
                3 -> Glide.with(context)
                    .load("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3540785673,3903576520&fm=26&gp=0.jpg")
                    .cropCenter().into(ivUrl)
            }
            tvName.text = "姓名:${entity.name}"
            tvStudyTitle.text = "爱好:${entity.hobby}"
            tvType.text = "编号：${entity.price}"
        }
    }
}